using System;
using System.Collections.Generic;
using SouthernLand.Common.DAL.Content;

namespace SouthernLand.Common.BOL.Content
{
    public class Contents
    {
        #region Public Properties

        public Int32 ContentID { get; set; }

        public String Title { get; set; }

        public String Title_en { get; set; }

        public String Content { get; set; }

        public String Content_en { get; set; }

        public Int32 DisplayOrder { get; set; }

        public Boolean IsActive { get; set; }

        #endregion

        #region public static Methods

        public static string GetstrContent(int ContentID)
        {
            try
            {
                Contents obj = GetContentsByID(ContentID);
                return Globals.GetLang(obj.Content, obj.Content_en);
            }
            catch
            {
                return "";
            }
        }

        public static string GetTitleByID(int ContentID)
        {
            try
            {
                Contents obj = GetContentsByID(ContentID);
                return Globals.GetLang(obj.Title, obj.Title_en);
            }
            catch
            {
                return "";
            }
        }

        public static int Insert(Contents obj)
        {
            var db = new ContentsDAL();
            return db.Insert(obj);
        }

        public static bool Update(Contents obj)
        {
            var db = new ContentsDAL();
            return db.Update(obj);
        }

        public static bool Delete(Int32 ContentID)
        {
            var db = new ContentsDAL();
            return db.Delete(ContentID);
        }

        public static Contents GetContentsByID(Int32 ContentID)
        {
            try
            {
                var db = new ContentsDAL();
                return db.GetContentsByID(ContentID);
            }
            catch
            {
                return null;
            }
        }

        //Get All Contents
        public static List<Contents> GetAllContents()
        {
            var db = new ContentsDAL();
            return db.GetAllContents(1, 10000);
        }

        //Get All Contents
        public static List<Contents> GetAllContents(int PageIndex, int PageSize)
        {
            var db = new ContentsDAL();
            return db.GetAllContents(PageIndex, PageSize);
        }

        // Get Count All records of Table  Contents
        public static int GetCountContents()
        {
            var db = new ContentsDAL();
            return db.GetCountContents();
        }
        #endregion
    }
}